#ifndef __HANDLE_SIGNAL__
#define __HANDLE_SIGNAL__
#include "signal.h"
#include <iostream>
namespace sdx {
class handleSignal {
private:
  struct sigaction act, oldAct;

public:
  handleSignal(/* args */){};
  ~handleSignal(){};

public:
  void sigMainHandle();
};
void handleSig(int sig) { std::cout << "the sigNo is " << sig << std::endl; }
void handleSignal::sigMainHandle() {
  act.sa_flags = 0;
  sigfillset(&act.sa_mask);
  act.sa_handler = handleSig;
  sigaction(SIGQUIT, &act, &oldAct);
  sigaction(SIGINT, &act, &oldAct);
  //   sigaction(SIGQUIT, &act, &oldAct);
  //   sigaction(SIGQUIT, &act, &oldAct);
}
} // namespace sdx

#endif